package com.yzl.prototype;

import java.time.Period;
import java.util.ArrayList;

/**
 * @program: design-pattern
 * @description:
 * @author: YaoZhiLi
 * @create: 2021-08-07 22:49
 */
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person = new Person();
        person.setName("张三");
        person.setAge(10);
        ArrayList<String> list = new ArrayList<>();
        person.getList().add("aaa");


        //浅拷贝
        Person person1 = person.clone();
        //深拷贝
//        Person person1 = person.deepClone();
        person1.setAge(12);
        person1.getList().add("bbb");
        System.out.println(person);
        System.out.println(person1);
    }
}